package com.lgc.netdemo.config

import okhttp3.Interceptor
import okhttp3.Response

/**
 * 自定义拦截器添加header
 */
class CommonInterceptor : Interceptor {
    override fun intercept(chain: Interceptor.Chain): Response {
        val original = chain.request()
        val request = original.newBuilder().
        header("Custom-Header", "CustomValue").
        addHeader("Content-Type", "application/json").
        addHeader("Authorization", "Bearer your_token")
            .build()
        return chain.proceed(request)
    }
}